@extends('Index/base')
@section('content')
	<div class="content clearfix bgf5">
		<section class="user-center inner clearfix">
			<div class="user-content__box clearfix bgf">
				<div class="title">购物车-确认支付 </div>
				<div class="shop-title">收货地址</div>
				<form action="/index/order/order_insert" method="post" class="shopcart-form__box">
					<div class="addr-radio">
						@foreach($address as $addr)
						<div class="radio-line radio-box">
							<label class="radio-label ep" title="">
								<input name="addr" value="" autocomplete="off" type="radio" required=""><i class="iconfont icon-radio"></i>
								{{$addr->address}} {{$addr->details}} （{{$addr->cnee}} 收） {{$addr->tel}}
							</label>
							<!-- <a href="/index/javascript:;" class="default">默认地址</a> -->
							<a href="/index/vip/udai_address_edit?id={{$addr->id}}" class="edit">修改</a>
						</div>
						@endforeach
						<script>
							$('input[name="addr"]').each(function(){
								$(this).val($(this).parent().text());
							})
						</script>
					</div>
					<div class="add_addr"><a href="/index/vip/udai_address">添加新地址</a></div>
					<div class="shop-title">确认订单</div>
					<div class="shop-order__detail">
						<table class="table">
							<thead>
								<tr>
									<th width="120"></th>
									<th width="300">商品信息</th>
									<th width="150">单价</th>
									<th width="200">数量</th>
									<th width="200">运费</th>
									<th width="80">总价</th>
								</tr>
							</thead>
							<tbody>
							@foreach($goods as $list)
								<tr>
									@if(isset($list->shopcartid))
									<input type="hidden" name="shopcartid[]" value="{{$list->shopcartid}}">
									<!-- <input type="hidden" name="sid[]" value="{{$list->sid}}"> -->
									<!-- <input type="hidden" name="num[]" value="{{$list->num}}"> -->
									@else
									<input type="hidden" name="sid" value="{{$list->sid}}">
									@endif
									<th scope="row"><a href="/index/webpage/item_show?id={{$list->gid}}"><div class="img"><img src="/upload/{{$list->img}}" alt="" class="cover"></div></a></th>
									<td style="text-align:left;">
										<div class="name ep3">{{$list->name}}</div>
										<div class="type c9">颜色分类：{{$list->color}}  尺码：{{$list->size}}</div>
									</td>
									<td>{{sprintf("%.2f",$list->price)}}</td>
									<td>{{$list->num}}</td>
									<td>¥0.0</td>
									<td>{{sprintf("%.2f",$list->price*$list->num)}}</td>
								</tr>
							@endforeach
							</tbody>
						</table>
					</div>
					<div class="shop-cart__info clearfix">
						<div class="pull-left text-left">
							<div class="info-line text-nowrap">购买时间：<span class="c6">{{date('Y年m月d日 H:i:s')}}</span></div>
							<div class="info-line text-nowrap">交易类型：<span class="c6">担保交易</span></div>
							<div class="info-line text-nowrap info-id">交易号：<span class="c6"></span></div>
							<input type="hidden" name="oid" value="">
							<input type="hidden" name="uid" value="{{session('uid')}}">
							<input type="hidden" name="date" value="{{date('Y年m月d日 H:i:s')}}">
							<input type="hidden" name="cost" value="{{sprintf('%.2f',$total)}}">
							<script>
								$('.info-id span').html(Math.random()*10e17);
								$("input[name='oid']").val($('.info-id span').html());
							</script>
						</div>
						<div class="pull-right text-right">
							<div class="form-group">
								<label for="coupon" class="control-label">优惠券使用：</label>
								<select id="coupon" >
									<option value="-1" selected>- 请选择可使用的优惠券 -</option>
								</select>
							</div>
							<script>
								$('#coupon').bind('change',function() {
									console.log($(this).val());
								})
							</script>
							<div class="info-line">优惠活动：<span class="c6">无</span></div>
							<div class="info-line">运费：<span class="c6">¥0.00</span></div>
							<div class="info-line"><span class="favour-value">已优惠 ¥0.0</span>合计：<b class="fz18 cr">¥{{sprintf("%.2f",$total)}}</b></div>
							<div class="info-line fz12 c9">（可获 <span class="c6">20</span> 积分）</div>
						</div>
					</div>
					<!-- <div class="shop-title">确认订单</div> -->
					<!-- <div class="pay-mode__box hidden">
						<div class="radio-line radio-box">
							<label class="radio-label ep">
								<input name="pay-mode" value="1" autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								<span class="fz16">余额支付</span><span class="fz14">（可用余额：¥88.0）</span>
							</label>
							<div class="pay-value">支付<b class="fz16 cr">18.00</b>元</div>
						</div>
						<div class="radio-line radio-box">
							<label class="radio-label ep">
								<input name="pay-mode" value="2" autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								<img src="/index/images/icons/alipay.png" alt="支付宝支付">
							</label>
							<div class="pay-value">支付<b class="fz16 cr">18.00</b>元</div>
						</div>
						<div class="radio-line radio-box">
							<label class="radio-label ep">
								<input name="pay-mode" value="3" autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								<img src="/index/images/icons/paywechat.png" alt="微信支付">
							</label>
							<div class="pay-value">支付<b class="fz16 cr">18.00</b>元</div>
						</div>
					</div> -->
					<div class="user-form-group shopcart-submit">
						<button type="submit" class="btn">确认订单</button>
					</div>
					<!-- <div class="user-form-group pay_box hidden">
						<div class=" col-sm-3">
							<input type="password" class="form-control" placeholder="请输入支付密码">
						</div>
						<button type="submit" class="btn">确认支付</button>
					</div> -->
					<script>
						// $(document).ready(function(){
						// 	$(this).on('change','input',function() {
						// 		$(this).parents('.radio-box').addClass('active').siblings().removeClass('active');
						// 	})
						// });

						// var oid=$('.info-id span').html();
						// var uid={{session('uid')}};
						// var address=$("input[name='addr']").val();
						// var sid=[];
						// sid.push();
						// $('.shopcart-submit .btn').click(function(){
						// 	$.post('/index/order/order_insert',{});
						// 	$(this).parent().hide();
						// 	$(this).parent().siblings('.pay_box').removeClass('hidden');
						// })
					</script>
				</form>
			</div>
		</section>
	</div>
@endsection